from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class editor_logic_state_typing_existing_kb_type_fake :
    def __init__ ( self ) :
        self . _activate_editor_state_typing_existing_kb_type = False
        self . _on_any_key = False
        self . _on_key_backspace = False
        self . _on_key_space = False
        self . _on_key_return = False
        self . _on_key_escape = False
        self . _receive_editor_entry_string = None
        self . _receive_kb_types_starting_with = None
        self . _receive_is_kb_type_stored = None
        self . _receive_is_any_marks_left_in_editor_contents = None
        self . _hide_editor = False
    def activate_editor_state_typing_existing_kb_type ( self ) :
        self . _activate_editor_state_typing_existing_kb_type = True
    def receive_editor_entry_string ( self , s ) :
        self . _receive_editor_entry_string = s
    def receive_kb_types_starting_with ( self , kb_types ) :
        self . _receive_kb_types_starting_with = kb_types
    def receive_is_kb_type_stored ( self , is_stored ) :
        self . _receive_is_kb_type_stored = is_stored
    def receive_is_any_marks_left_in_editor_contents ( self , any_marks ) :
        self . _receive_is_any_marks_left_in_editor_contents = any_marks
    def on_any_key ( self ) :
        self . _on_any_key = True
    def on_key_backspace ( self ) :
        self . _on_key_backspace = True
    def on_key_space ( self ) :
        self . _on_key_space = True
    def on_key_return ( self ) :
        self . _on_key_return = True
    def on_key_escape ( self ) :
        self . _on_key_escape = True
    def hide_editor ( self ) :
        self . _hide_editor = True

class arbitrary_module_fake :
    def on_any_key ( self ) :
        pass
    def on_key_backspace ( self ) :
        pass
    def on_key_space ( self ) :
        pass
    def on_key_return ( self ) :
        pass
    def on_key_escape ( self ) :
        pass
    def receive_is_any_marks_left_in_editor_contents ( self , any_marks ) :
        pass
    def receive_editor_entry_string ( self , s ) :
        pass
    def receive_is_kb_type_stored ( self , is_stored ) :
        pass
    def hide_editor ( self ) :
        pass

class mediator_editor_logic_state_typing_existing_kb_type_tests : 
    'mediator_editor_logic_state_typing_existing_kb_type'
    def __init__ ( self , test ) :
        self . _test = test
        self . _editor_logic_state_typing_existing_kb_type = editor_logic_state_typing_existing_kb_type_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'editor_logic_state_typing_existing_kb_type' 
            , self . _editor_logic_state_typing_existing_kb_type
            , arbitrary_module_fake
            ) )
    def test_activate_editor_state_typing_existing_kb_type ( self ) :
        self . _mediator . activate_editor_state_typing_existing_kb_type ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _activate_editor_state_typing_existing_kb_type )
    def test_on_any_key ( self ) :
        self . _mediator . on_any_key ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _on_any_key )
    def test_on_key_backspace ( self ) :
        self . _mediator . on_key_backspace ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _on_key_backspace )
    def test_on_key_space ( self ) :
        self . _mediator . on_key_space ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _on_key_space )
    def test_on_key_return ( self ) :
        self . _mediator . on_key_return ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _on_key_return )
    def test_on_key_escape ( self ) :
        self . _mediator . on_key_escape ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _on_key_escape )
    def test_receive_editor_entry_string ( self ) :
        self . _mediator . receive_editor_entry_string ( 'my string' )
        self . _test . assume_equal ( self . _editor_logic_state_typing_existing_kb_type . _receive_editor_entry_string , 'my string' )
    def test_receive_kb_types_starting_with ( self ) :
        self . _mediator . receive_kb_types_starting_with ( 'my types' )
        self . _test . assume_equal ( self . _editor_logic_state_typing_existing_kb_type . _receive_kb_types_starting_with , 'my types' )
    def test_receive_is_kb_type_stored ( self ) :
        self . _mediator . receive_is_kb_type_stored ( 'my stored' )
        self . _test . assume_equal ( self . _editor_logic_state_typing_existing_kb_type . _receive_is_kb_type_stored , 'my stored' )
    def test_receive_is_any_marks_left_in_editor_contents ( self ) :
        self . _mediator . receive_is_any_marks_left_in_editor_contents ( 'my marks' )
        self . _test . assume_equal ( self . _editor_logic_state_typing_existing_kb_type . _receive_is_any_marks_left_in_editor_contents , 'my marks' )
    def test_hide_editor ( self ) :
        self . _mediator . hide_editor ( )
        self . _test . assume_true ( self . _editor_logic_state_typing_existing_kb_type . _hide_editor )
